import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueDevTools from 'vite-plugin-vue-devtools';
import AutoImport from 'unplugin-auto-import/vite';
import { envParse } from 'vite-plugin-env-parse';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';

export default defineConfig((env) => ({
  resolve: { alias: { '@': '/src' } },
  build: {outDir: `dist/${env.mode}`}, // 打包输出目录
  envDir: './configurations/env',
  plugins: [vue(),
    VueDevTools(),
    envParse({ dtsPath: './configurations/types/.env.d.ts' }), // 环境变量提示
    AutoImport({
			dts: './configurations/types/auto-import.d.ts',
			imports: ['vue'], resolvers: [VantResolver()],
		}),
    Components({
      dts: './configurations/types/components.d.ts',
      resolvers: [VantResolver()],
    }),
  ],
}))
